package com.byb.server.service.mapper;

import com.byb.server.domain.*;
import com.byb.server.service.dto.MildCaseDTO;

import org.mapstruct.*;

/**
 * Mapper for the entity MildCase and its DTO MildCaseDTO.
 */
@Mapper(componentModel = "spring", uses = {ProductMapper.class, })
public interface MildCaseMapper extends EntityMapper <MildCaseDTO, MildCase> {

    @Mapping(source = "product.id", target = "productId")
    @Mapping(source = "product.productName", target = "productProductName")
    MildCaseDTO toDto(MildCase mildCase); 

    @Mapping(source = "productId", target = "product")
    MildCase toEntity(MildCaseDTO mildCaseDTO); 
    default MildCase fromId(Long id) {
        if (id == null) {
            return null;
        }
        MildCase mildCase = new MildCase();
        mildCase.setId(id);
        return mildCase;
    }
}
